<?php

class Players extends Controller {

	public function browse($status="all") {
		$this->set("uuid", $_POST["uuid"]);
		$this->set("status", $status);
		$this->set("player", $player = $this->_getPlayer());
		// YAMB Users
		$q = "SELECT * "
			."FROM players "
			."WHERE 1"
				.($status!="all"?" AND status='$status'":"")
				." AND online=1"
				." AND id!=" . $player["id"]
			." ORDER BY username";
		$this->set("users", $this->db_query($q));

		error_reporting(E_ALL);
		ini_set("display_errors", "On");

		// Facebook Users
		$FBfriends = array();
		try {
			$FBfriends = $this->FB->api("/me/friends");
		}catch(FacebookApiException $e) {

		}
		$this->set("fb_player", $this->FB->api("/me"));
		$this->set("fb_users", $FBfriends["data"]);

		$this->display("players/browse");
	}
}

?>